package com.samphanie.auiu.common.ui.component.base

import androidx.databinding.DataBindingUtil

import androidx.databinding.ViewDataBinding

/**
 * @author Dries
 **/
abstract class BaseBindingActivity<B: ViewDataBinding>:  BaseActivity(), ViewBehavior  {

    protected lateinit var binding: B
        private set

    override fun initContentView() {
        injectDataBinding()
    }

    protected open fun injectDataBinding() {
        binding = DataBindingUtil.setContentView(this, getLayoutId())
        binding.lifecycleOwner = this
    }

    override fun onDestroy() {
        super.onDestroy()
        binding.unbind()
    }
}